#include "searchpro.h"
#include "ui_searchpro.h"
#include <QDebug>
#include "searchwin.h"
#include "program.h"
#include "mainwindow.h"
extern int n;
extern vector <Program*> prdata;
searchpro::searchpro(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::searchpro)
{
    ui->setupUi(this);
    ui->lineEdit->setText(prdata[n]->showid());
    ui->lineEdit_2->setText(prdata[n]->showname());
    ui->lineEdit_3->setText(prdata[n]->showtype());
    ui->lineEdit_4->setText(prdata[n]->showmaster());
    ui->lineEdit_5->setText(prdata[n]->showfield());
    ui->lineEdit_6->setText(prdata[n]->showtime());
    QString mon = QString("%4").arg(prdata[n]->showmoney());
    ui->lineEdit_7->setText(mon);
    if(prdata[n]->showstatus()==1)
    ui->lineEdit_8->setText("已完成");
    else if(prdata[n]->showstatus()==0&&prdata[n]->agreeornot()==1)
    ui->lineEdit_8->setText("等待结题");
    else if(prdata[n]->showstatus()==3){
    ui->lineEdit_8->setText("正在申请");
    }
    else if(prdata[n]->showstatus()==0)
    ui->lineEdit_8->setText("未完成");
    ui->textEdit->setText(prdata[n]->showrem());
    QString peo = prdata[n]->people[0];
    for(unsigned int i =1;i<prdata[n]->people.size();i++)
    {
        peo=  peo+","+prdata[n]->people[i];
    }
     ui->textEdit_2->setText(peo);
}
searchpro::~searchpro()
{
    delete ui;
}

void searchpro::on_pushButton_clicked()
{
    closeEvent(0);
    searchwin *p = new searchwin;
    p->show();
}
